package com.daqsoft;

import org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext;
import org.springframework.boot.devtools.autoconfigure.LocalDevToolsAutoConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

/**
 * @author 周麟东 on 17:49
 */
@Component
public class AppListener implements ApplicationListener<ContextRefreshedEvent> {

    private static  ApplicationContext context;

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        context = event.getApplicationContext();
    }

    public static ApplicationContext getApplicationContext(){
        return context;
    }

//    private void loadCache(){
//        UserCache.ins().load(userDao.findAll());
//        GroupCache.ins().load(groupDao.findAll());
//        ModuleCache.ins().load(moduleDao.findAll());
//        PermissionConfigCache.ins().load(permissionConfigDao.findAll());
//    }

}
